<?php
    require_once "../config/db.php";
        
    class Select extends DB{
        function return_menu(){
            $sql = "select id, name from menu";
            $res = $this->sql($sql);        
            return $res;
        }
        
        function return_adminmenu(){
            $sql = "select id, name from admin_menu";
            $res = $this->sql($sql);        
            return $res;
        }
        
        function return_users(){
            $sql = "select id_user, name, surname, email, fac_id, group_id,reg_date, status from users";
            $res = $this->sql($sql);
            return $res;
        }                          
        
        function return_fac(){
            $sql = "select fac_id, fac_name from faculty";
            $res = $this->sql($sql);
            return $res;
        }     
        
        function return_group(){
            $sql = "Select group_id, g_name from groups";
            $res = $this->sql($sql);
            return $res;
        }   
		
		function return_news(){
			$sql = "SELECT id, date, user_name, title, pre_vision, full_vision, id_user FROM news ORDER BY date DESC" ;
			$res = $this->sql($sql);
			return $res;
		}      
		
		function return_com(){
			$sql = "SELECT author, text, date, id_news FROM comment ORDER BY date DESC";
            $res = $this->sql($sql);
            return $res;
		}   
        
        function settings ($id){
            $sql = "SELECT name, surname, password, email, fac_id FROM users WHERE id_user = $id";
            $res = $this->sql($sql);
            return $res;
        }                         
    }   
?>